package com.cy.pj.common.pojo;

/**
 * 服务端响应到客户端的结果对象设计
 */
public class ResponseResult {

    private static final int SUCCESS=1;
    private static final int ERROR=0;

    /** 响应数据的状态 */
    private Integer state=SUCCESS;
    /** 状态对应的信息 */
    private String message="ok";
    /** 服务器响应到客户端的查询结果 */
    private Object data;

    public ResponseResult (String message){
        this.message=message;
    }

    public ResponseResult(Object data) {
        this.data=data;
    }

    public ResponseResult(Throwable e){//出现异常以后
        this.state=ERROR;
        this.message=e.getMessage();
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
